import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../theme/xlcolors.dart';
import '../theme/xlsize.dart';

AppBar baseAppBar(
    {Widget? leading,
    String? title,
    List<Widget>? actions,
    VoidCallback? backCall}) {
  return AppBar(
    centerTitle: true,
    elevation: 0,
    title: Text(title == null ? "title" : title),
    backgroundColor: Colors.white,
    toolbarHeight: XlSize.baseTitleHeight,
    leading: IconButton(
      icon: Icon(Icons.arrow_back_ios_new, color: XlColors.bgTitleBack),
      onPressed: backCall == null ? (() => {Get.back()}) : backCall,
    ),
    actions: actions,
    automaticallyImplyLeading: true,
    // 和leading配合使用，如果为true并且leading为空的情况下，会自动配置返回键
    titleTextStyle: const TextStyle(
        fontSize: XlSize.heightBaseTitleSize, color: XlColors.textTitle),
    // 底部分割线
    shape: const Border(
        bottom: BorderSide(color: XlColors.dividerColor, width: 0.5)),
  );
}
